Skip to content

feat(cli): add OpenCode-compatible workspace diff viewer - #1945

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/cli-workspace-diff
Aug 1, 2026
Merged

feat(cli): add OpenCode-compatible workspace diff viewer#1945
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/cli-workspace-diff

Conversation

@limityan

@limityan limityan commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

变更概述

  • 增加与 OpenCode 一致的 /diff 入口,不新增 alias 或快捷键;仅在 Turn 空闲时可用,支持 n/p 切换文件、[/] 跳转 hunk、方向键及 PageUp/PageDown 滚动。
  • services-integrations 持有 Git 仓库发现、状态与 HEAD 到工作树净补丁计算,通过 Runtime Port 同时供 Embedded 与 Shared TUI 使用;Shared IPC 协议升级到 v11。
  • 查询保持有界:最多 256 个文件、单文件 1 MiB、文本总量 3 MiB;二进制、超限、冲突和 staged/worktree 相互抵消均有明确展示。
  • Session 使用其他 worktree 或 Remote execution 时 fail-closed,避免展示 Runtime 绑定项目目录中的错误本地事实。

架构与边界

  • TUI 只负责快照与导航状态;Git 实现位于 integration provider,Core 只注入 GitPort,Runtime/SDK/IPC 复用同一契约。
  • /diff 为只读能力,不包含 split diff、stage/reset/commit、变更归因、watcher、Remote 或 Relay 映射。
  • Shared operation 不获取 Session lease,但要求连接空闲;diff 加载期间同一 Shared 客户端串行化其他 Runtime 请求,避免阻塞事件与控制操作。

验证

  • cargo check --workspace
  • cargo test -p bitfun-runtime-ports --test git_port_contracts
  • cargo test -p bitfun-services-integrations --no-default-features --features git --test git_contracts(24 passed)
  • cargo test -p bitfun-agent-runtime --test sdk_smoke(6 passed)
  • cargo test -p bitfun-agent-runtime-ipc(51 passed)
  • cargo test -p bitfun-core local_runtime_services_bind_git_queries_to_the_canonical_workspace -- --nocapture
  • cargo test -p bitfun-cli(519 unit tests 及 CLI integration tests passed)
  • node scripts/check-core-boundaries.mjs

补充:尝试执行 cargo test --workspace 时,被未触及文件中的既有 test-only 缺失导入阻断:services/terminal/src/exec.rs 缺少 PathBufservices-integrations/src/plugin_source.rs 缺少 native_path_identity;上述 production workspace check 与本 PR 范围测试均通过。

Expose a bounded HEAD-to-worktree snapshot through Runtime Git ports and Shared IPC. Add the OpenCode-compatible /diff TUI with responsive navigation and fail-closed worktree and remote boundaries.
@limityan
limityan merged commit 44e5f48 into GCWing:main Aug 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant